<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta content="telephone=no" name="format-detection" />
    <title>友吃送“福梨”活动</title>
    <link rel="stylesheet" href="<{$smarty.const.__STATIC__}>css/layout.css" />
    <link rel="stylesheet" href="<{$smarty.const.__STATIC__}>css/style.css" />
</head>
<body style="background: #ebebeb;  padding-bottom: 1rem;">

<div id="adv-header">
    <div class="header-inner">
        <div class="tit"><img src="<{$smarty.const.__STATIC__}>images/tit2.png" /></div>
        <div class="ren"><img src="<{$smarty.const.__STATIC__}>images/ren.png" /></div>
        <img class="bac" src="<{$smarty.const.__STATIC__}>images/xqbac.jpg"/>
    </div>
</div>
<div id="adv-btns">
    <div class="name">
            <span class="name-png">
                <img src="<{$smarty.const.__STATIC__}>images/name.png" />
            </span>
    </div>
    <div class="btn">
        <input id="like-openid" type="hidden" name="like_person_openid" value="<{$like_person_openid}>"/>
        <input id="bei-like-openid" type="hidden" name="bei_like_openid" value="<{$bei_like_openid}>"/>
        <a href="#" id="like-btn">点击帮<{$name}>抢福梨</a>
    </div>
    <div class="btn">
        <a href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=<{$smarty.const.APPID}>&redirect_uri=<{$smarty.const.DOMAIN}>register.php&response_type=code&scope=snsapi_base&state=1#wechat_redirect">我也要抢福利</a>
    </div>

</div>
<div id="rank-bar">
    <h3>实时投票排行榜</h3>
    <ul class="rank-list">
        <{foreach from=$userList key=num item=user}>
        <li><span class="l">第 <{$i=$i+1}><{$i}> 名</span><span class="c"><{$user->name}></span><span class="r"><{$user->like_count}>票</span></li>
        <{/foreach}>
    </ul>

</div>
<div id="rule">
    <h2 class="rule-tit"><span>活动规则<em class="arrr arr"><img src="<{$smarty.const.__STATIC__}>images/arr.png"/></em><em class="arr arrl"><img src="<{$smarty.const.__STATIC__}>images/arr.png"/></em></span></h2>
    <dl class="mianf">
        <dt><span>免费福梨1：</span></dt>
        <dd>收集满20个好友投票的，可免费获得友吃送出的连州水晶梨礼盒一份，限量400份。</dd>
    </dl>

    <dl class="mianf">
        <dt><span>免费福梨2：</span></dt>
        <dd>8月09日上午12点投票截止，票数最高的前10名吃货达人可赢得<a href="zen.html">（曾屋料理）</a>送出的250元/位下午茶聚会（因个人原因无法参加的，友吃不承担其损失）；与友吃小编一起玩游戏，品下午茶。</dd>
    </dl>
    <dl class="mianf">
        <dt><span>注意事项：</span></dt>
        <dd>获得奖品，请下载【友吃】APP，填写个人收货信息；</dd>
        <dd>8月09日下午会有专人客服电话联系确认收货地址和免费下午茶聚会的参加时间；</dd>
        <dd>【友吃】微信公众号也会同时公布美食下午茶的10位吃货达人的免费名单和活动时间，敬请留意；</dd>
        <dd>快递会在8月10日后统一发货，若在发货5日内未收到水晶梨，或对活动内容有疑问，请与【友吃】公众号客服联系，或致电020-81245266查询</dd>
        <dd>如发现恶意刷票行为立即取消参与资格，活动最终解释权，归【友吃】App官方所有！</dd>
    </dl>
</div>
<div id="all-page" style="display: none;"></div>
<div class="bot-hint">
    <span class="hint-png"><img src="<{$smarty.const.__STATIC__}>images/arrow_w.png" /></span>
</div>
<div id="xinxi" class="fixed-box" style="display: none;">
    <div class="fixed-cont">
        <div class="xinxi">
            <div class="que-bar">
                <span class="que"><img src="<{$smarty.const.__STATIC__}>images/que.png"></span>
            </div>
            <div class="que-txt"> 只能为好友抢一次福利哦！</div>
            <div class="que-btn">确定</div>
        </div>
    </div>
</div>
<script src="<{$smarty.const.__STATIC__}>js/zepto.min.js" type="text/javascript"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js" type="text/javascript"></script>
<script src="<{$smarty.const.__STATIC__}>js/public.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function(){
        // 表单注册
        $('#like-btn').on('tap',function(){
            var url = 'like.php';
            var likeOpenid = $('#like-openid').val();
            var beiLikeOpenid = $('#bei-like-openid').val();
            if(likeOpenid == beiLikeOpenid){
                $("#xinxi").css("display","block").find(".que-txt").text("不能给自己投票");
                $("#all-page").show();
                //alert('不能给自己点赞');
                return;
            }
            var data = {like_person_openid: likeOpenid,bei_like_openid: beiLikeOpenid};
			/*
            $.ajax({
                type: "post",
                url: url,
                dataType: "text",
                data: $.param(data),
                success: function(text){
                    var msg = text.split('_');
                    $("#xinxi").css("display","block").find(".que-txt").text(msg[1]);
                    $("#all-page").show();
                },
                error : function (json) {
                    alert("error"+ JSON.stringify(json));
                }
            });
			*/
        });
    });

    // 微信js验证
    wx.config({
        debug: false,
        appId: '<{$appId}>',
        timestamp: '<{$timestamp}>',
        nonceStr: '<{$nonceStr}>',
        signature: '<{$signature}>',
        jsApiList: [// 所有要调用的 API 都要加到这个列表中
            'checkJsApi',
            'onMenuShareTimeline',
            'onMenuShareAppMessage']
    });
    wx.error(function(res){

        alert(JSON.stringify(res));

    });
    // 在这个方法里面执行接口调用
    wx.ready(function(){
        var title='友吃送“福梨”活动',
                desc = '我是【<{$name}>】，快来帮我抢连州水晶梨吧！',
                imgUrl = 'http://wx.youchi365.com/static/images/tit2.png',
                link = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=<{$smarty.const.APPID}>&redirect_uri=<{$smarty.const.DOMAIN}>ac_index.php&response_type=code&scope=snsapi_base&state=<{$bei_like_openid}>#wechat_redirect';

        // 调用微信js，分享给朋友
        wx.onMenuShareAppMessage({
            title: title,
            desc: desc,
            link: link,
            imgUrl: imgUrl,
            success: function (res) {
                alert('分享好友成功');
            },
            cancel: function (res) {
                alert('已取消');
            },
            fail: function (res) {
                alert(JSON.stringify(res));
            }
        });
        // 调用微信js,分享到朋友圈
        wx.onMenuShareTimeline({
            title: title, // 分享标题
            link: link, // 分享链接
            imgUrl: imgUrl, // 分享图标
            success: function () {
                // 用户确认分享后执行的回调函数
                alert('分享朋友圈成功');
            },
            cancel: function () {
                // 用户取消分享后执行的回调函数
                alert('已取消');
            }
        });
    });

</script>
</body>
</html>